/**
 * 
 */
package com.leo.jdkcore.kafka;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Description:
 * 
 * @author lianliang
 * @date 2017年12月9日 上午11:34:49
 */
public class MsgProcessTask implements Runnable {
	private static final Logger LOG = LoggerFactory.getLogger(MsgProcessTask.class);

	private String msg;
	private KafkaReaderContext context;

	/**
	 * @param msg
	 */
	public MsgProcessTask(String msg, KafkaReaderContext context) {
		this.msg = msg;
		this.context = context;
	}

	/**
	 * 
	 */
	private void process() {
		try {
			LOG.info("MsgProcessTask 消费数据：{}", msg);
			RequestService service = new RequestService(context);
			service.execute(msg);
		} catch (Exception e) {
			LOG.error("MsgProcessTask 消费数据：{}", e);
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Runnable#run()
	 */
	@Override
	public void run() {
		process();
	}

}
